Error object 'int' not iterable in custom seq function